Imports System.Windows.Forms

Public Class frmExportMult

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub btnBrowse_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnBrowse.Click
        With New FolderBrowserDialog
            .SelectedPath = txtDestFolder.Text
            If .ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
                txtDestFolder.Text = .SelectedPath
                .Dispose()
            Else
                .Dispose()
                Exit Sub
            End If
        End With
    End Sub

    Private Sub frmExportMult_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        SaveSetting(REGAPP, Me.Name, "FileFormat", cboFileFormat.Text)
        SaveSetting(REGAPP, Me.Name, "DateFormat", cboDateFormat.Text)
        SaveSetting(REGAPP, Me.Name, "RefDate", dtRefDate.Value)
        SaveSetting(REGAPP, Me.Name, "DestFolder", txtDestFolder.Text)
    End Sub

    Private Sub frmExportMult_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            cboFileFormat.Text = GetSetting(REGAPP, Me.Name, "FileFormat", cboFileFormat.Items(0))
            cboDateFormat.Text = GetSetting(REGAPP, Me.Name, "DateFormat", cboDateFormat.Items(0))
            dtRefDate.Value = CDate(GetSetting(REGAPP, Me.Name, "RefDate", "1/1/1900"))
            txtDestFolder.Text = GetSetting(REGAPP, Me.Name, "DestFolder", AppDataPath)
        Catch ex As Exception
        End Try
    End Sub

    Private Sub txtDestFolder_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDestFolder.TextChanged
        ToolTip1.SetToolTip(txtDestFolder, txtDestFolder.Text)
    End Sub

    Private Sub cboDateFormat_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboDateFormat.SelectedIndexChanged
        dtRefDate.Enabled = cboDateFormat.Text.Contains("Julian")
    End Sub
End Class
